﻿using AdminSystem.Application.Commands.BreedCommands;
using AdminSystem.Application.Dtos;
using AdminSystem.EntityFramworkCore;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace AdminSystem.WebAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BreedController : ControllerBase
    {
        private readonly IMediator mediator;
        public BreedController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpPost]
        public async Task<APIResult<object>> AddBreed(BreedAddCommand command)
        {
            return await mediator.Send(command);
        }
        [HttpGet]
        public async Task<APIResult<BreedDTO>> GetBreed(int Id)
        {
            BreedQueryCommand command = new BreedQueryCommand();
            command.Id = Id;
            return await mediator.Send(command);
        }
        [HttpPost]
        public async Task<APIResult<object>> UpdBreed(BreedUpdCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
